package com.csjbot.weedle_auto.app

import android.app.Application
import com.csjbot.weedle_auto.SerialServer.SerialPortServer
import com.csjbot.weedle_auto.Slam.agent.RPSlamwareSdpAgent
import kotlin.properties.Delegates

/**
 * Created by chenqi on 8/7/17.
 */

class BaseApplication : Application() {
    var agent: RPSlamwareSdpAgent by Delegates.notNull()   // 使用 Dagger 2 注入
    var serial: SerialPortServer by Delegates.notNull()   // 使用 Dagger 2 注入

    override fun onCreate() {
        super.onCreate()
        instance = this
        agent = RPSlamwareSdpAgent.getAgent(this)
        serial = SerialPortServer.createSerialPortServer()
    }

    companion object {
        var instance: BaseApplication by Delegates.notNull()
    }
}
